:root{
  --ui-scale: 1;
}

@function strip-unit($number){
  @if type-of($value: $number) == 'number' and not unitless($number) {
    // $number * 0将会获得这个值的单位，单位+1就是1单位，number除于1单位就是将number的单位去除
    @return $number / ($number * 0 + 1);
  }

  @return $number;
}

@function D($v){
  $baseValue: strip-unit($v) * 1px;
  @return calc(#{$baseValue} * var(--ui-scale));
}

@mixin ScaleFont($fontSize, $lineHeight) {
  font-size: D($fontSize * $mainFontScale);
  line-height: D($lineHeight * $mainFontScale);
}

@mixin S($propName, $v1, $v2: "", $v3: "", $v4: "", $important: false) {
  $impSuffix: "";
  @if $important == true{
    $impSuffix: '!important';
  }

  $v1: D($v1);
  
  @if $v2 != '' {
    $v2: D($v2);
  }
  @if $v3 != '' {
    $v3: D($v3);
  }
  @if $v4 != '' {
    $v4: D($v4);
  }

  #{$propName}: #{$v1} #{$v2} #{$v3} #{$v4} #{$impSuffix};
}